package com.example.milimili;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.viewpager2.widget.ViewPager2;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import com.example.milimili.util.DateUtil;
import com.example.milimili.util.WebChecker;
import com.google.android.material.tabs.TabLayout;
import com.google.android.material.tabs.TabLayoutMediator;

public class MainActivity extends AppCompatActivity {

    public static final String FIRSTPART="https://api2.newsminer.net/svc/news/queryNewsList?size=50&startDate=2021-08-20&endDate=";
    public static final String SECONDPART="&words=";
    public static final String THIRDPART="&categories=";
    public static final String ONEPART="https://api2.newsminer.net/svc/news/queryNewsList?size=";
    public static final String TWOPART="&startDate=2021-08-20&endDate=";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
            initSearchStatic();
            initFragment();
            NewsActivity.flag=true;
    }

    private void initSearchStatic() {
            SearchActivity.startDate="2021-08-20";
            SearchActivity.endDate=DateUtil.getNowDateTime();
            SearchActivity.category="";
    }

    private void initFragment() {
        FragmentManager fm=getSupportFragmentManager();
        FragmentTransaction fragmentTransaction=fm.beginTransaction();
        fragmentTransaction.replace(R.id.frameLayout,new MainFragment());
//        fragmentTransaction.replace(R.id.bottomLayout,new FragmentBottom());
        fragmentTransaction.commit();
    }

}